package moon.search.criterion.logic;

import java.util.ArrayList;
import java.util.List;

import moon.search.criterion.Criterion;
import moon.search.criterion.IllegalCriterionException;
import moon.search.criterion.LogicalCriterion;

public class Not extends LogicalCriterion {

	
	public Not(Criterion criterion){
		this.setCriteria(new ArrayList<Criterion>());
		this.getCriteria().add(criterion);		
	}
	
	public boolean isFulfilled(Object object) throws IllegalCriterionException {
		List<Criterion> criteria = this.getCriteria();
		boolean result = true;
		
		for (Criterion c : criteria){
			result = this.isFulfilled(object);
		}
		return !result;
	}

}
